From c72df674d1c7d24015d84b70aa232684622d2c3f Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 4 Aug 2017 20:21:38 -0700 Subject: [PATCH] test for mandatory dependencies not to be considered features --- tests/features.rs | 65 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/tests/features.rs b/tests/features.rs index 786db0470..f004d366a 100644 --- a/tests/features.rs +++ b/tests/features.rs @@ -225,6 +225,71 @@ fn invalid8() { ")); } +#[test] +fn invalid9() { + let p = project("foo") + .file("Cargo.toml", r#" + [project] + name = "foo" + version = "0.0.1" + authors = [] + + [dependencies.bar] + path = "bar" + "#) + .file("src/main.rs", "") + .file("bar/Cargo.toml", r#" + [package] + name = "bar" + version = "0.0.1" + authors = [] + "#) + .file("bar/src/lib.rs", ""); + + assert_that(p.cargo_process("build").arg("--features").arg("bar"), + execs().with_status(101).with_stderr("\ +[ERROR] Package `foo v0.0.1 ([..])` does not have these features: `bar` +")); +} + +#[test] +fn invalid10() { + let p = project("foo") + .file("Cargo.toml", r#" + [project] + name = "foo" + version = "0.0.1" + authors = [] + + [dependencies.bar] + path = "bar" + features = ["baz"] + "#) + .file("src/main.rs", "") + .file("bar/Cargo.toml", r#" + [package] + name = "bar" + version = "0.0.1" + authors = [] + + [dependencies.baz] + path = "baz" + "#) + .file("bar/src/lib.rs", "") + .file("bar/baz/Cargo.toml", r#" + [package] + name = "baz" + version = "0.0.1" + authors = [] + "#) + .file("bar/baz/src/lib.rs", ""); + + assert_that(p.cargo_process("build"), + execs().with_status(101).with_stderr("\ +[ERROR] Package `bar v0.0.1 ([..])` does not have these features: `baz` +")); +} + #[test] fn no_transitive_dep_feature_requirement() { let p = project("foo") -- 2.30.2